package com.codingfuture.erp_system.service.impl;


import com.codingfuture.erp_system.dto.RoleDto;
import com.codingfuture.erp_system.dto.RolePwdDto;
import com.codingfuture.erp_system.mapper.RoleMapper;
import com.codingfuture.erp_system.service.RoleService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

@Service
public class RoleServiceImpl implements RoleService {

    @Autowired
    private RoleMapper roleMapper;

    @Override
    public List<RoleDto> findByAll() {
        return roleMapper.findByAll();
    }

    @Override
    @Transactional(rollbackFor = Exception.class)
    public Boolean update(RolePwdDto rolePwdDto) {
        return roleMapper.update(rolePwdDto) != 0;
    }
}
